import { connect } from 'react-redux'
import AdminCourseEdit from "../../components/admin/AdminCourseEdit/AdminCourseEdit.jsx"
import {getCourse,setCourse,delCourse} from "../../actions/admin/course_edit_actions"

const mapDispatchToProps = (dispatch) => {
    return {
        init : (courseId) => {
            dispatch(getCourse(courseId))
        },
        setCourse : (course) => {
            dispatch(setCourse(course))
        },
        delCourse: (id,videoLocation) => {
            dispatch(delCourse(id,videoLocation))
        }
    }
}

const mapStateToProps = (state,ownProps) => {
    const {courseEdit} = state
    return {
        course : courseEdit.course
    }
}

const AdminCourseEditContainer = connect(
    mapStateToProps,
    mapDispatchToProps
)(AdminCourseEdit)

export default AdminCourseEditContainer